package com.huawei;

import java.util.Scanner;

/**
 * Created by Z-hong on 2024/7/16.
 */

public class HJ33 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str_set=scanner.next();
        String str_get=scanner.next();
        System.out.println(setStr(str_set));
        System.out.println(getStr(str_get));
    }

    public static String setStr(String str){
        String[] split = str.split("\\.");
        long count =0;
        int num=1;
        for (int i = split.length-1;i>=0 ; i--) {
            count+=Long.parseLong(split[i])*num;
            num*=256;
        }
        return String.valueOf(count);
    }
    public static String getStr(String str){
        String[] split = new String[4];
        int num=256*256*256;
        long count=Long.parseLong(str);
        for (int i = 0; i < split.length; i++) {
            split[i]=count/num+"";
            count%=num;
            num/= 256;
        }


        return String.join(".",split);
    }
}
